import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import { requestMoveList } from "../api";

export const getMoveListAction = createAsyncThunk(
  "Move/getMoveList",
  async () => {
    const result = await requestMoveList();
    return result.data.data.list;
  }
);

const createslice = createSlice({
  name: "Move",
  initialState: {
    moveList: [],
  },
  reducers: {},
  extraReducers: {
    [getMoveListAction.fulfilled](state, { type, payload }) {
      console.log(type);
      state.moveList = payload;
    },
  },
});

export default createslice.reducer;
